<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
<head>
<title>GetCLIVersion Sample</title>
<link rel="stylesheet" type="text/css" href="../../../docs/rotor.css">
</head>

<body>		


<h1> GetCliVersion Sample</h1>


<h2>Sample Overview</h2>


<p>This sample supports viewing and changing the runtime version number of an 
assembly.&nbsp;The SSCLI execution environment ignores this value. The 
.NET Framework common language runtime uses this value to determine which runtime version to load 
initially when loading an executable assembly.&nbsp;By default, compilers 
usually emit the version number of 
the CLI under which the assembly was built.&nbsp; </p>


<p>This sample supports modification of the version number but this is for 
experimental purposes only. If you modify the runtime version of a 
strongly named assembly that has been signed, that assembly will no longer load 
because the signing checksum will have changed.&nbsp;Also, you might  not be able to 
change the version number to a larger number than the existing one in the binary 
portable executable (PE) assembly file.</p>


<p>The following table shows the command-line options supported by this sample.</p>


<table border="1" width="90%">
  <tr valign="top">
    <th width="29%">Option<th width="71%">Description</tr>
  <tr valign="top">
    <td width="29%"><b>/?<br>
    /help</b></td>
    <td width="71%">Shows usage information.</td>
  </tr>
  <tr>
    <td width="29%"><b>/confirmset <i>true|false</i></b></td>
    <td width="71%">If <b>true</b>, then  sets the version, unloads the file, reopens 
    the file and confirms that the new setting is correct.&nbsp; The default is
    <b>false</b>.</td>
  </tr>
  <tr valign="top">
    <td width="29%"><b>/getver</b></td>
    <td width="71%">Prints the common language runtime version number of the assembly.&nbsp; 
    This is the default option if only a file name is specified.</td>
  </tr>
  <tr valign="top">
    <td width="29%"><b>/setver</b></td>
    <td width="71%">Changes the runtime version number within the assembly.</td>
  </tr>
</table>


<h2>Sample Source and Build Output Locations</h2>


<p>The sample source is found in sscli20\samples\utilities\getcliversion.&nbsp; </p>


<p>The source files are:</p>


<ul class="none">
  <li><a href="getcliversion.cs">getcliversion.cs</a></li>
  <li><a href="imagehelp.cs">imagehelp.cs</a></li>
  <li><a href="pereader.cs">pereader.cs</a></li>
</ul>


<p>The build output location is %_NTTREE%\samples\utilities\getcliversion.&nbsp; 
The output file is an executable assembly named getcliversion.exe.</p>


<h2>Building the Sample</h2>


<p>All samples are built from the buildall script.&nbsp;  </p>


<p>You can also build all the 
samples by switching to the root of the sample directory, sscli20\samples, and typing 
<code>build -c</code>.</p>


<p>You can build this specific sample  by switching to the sample directory and typing 
<code>build -c</code>.</p>


<h2>Running the Sample</h2>


<p>These steps require that the Shared Source CLI (SSCLI) be already built and 
functional.</p>


<ol>
  <li>Run  env.bat. </li>
  <li>Switch to the %_NTTREE%\samples\utilities\getcliversion directory.</li>
  <li>Type the following command:<blockquote>


<p>clix getcliversion.exe <i>filename</i></p>


  </blockquote>


  </li>
</ol>
<blockquote>


<p>where <i>filename</i> is the name of a managed executable or library 
assembly.&nbsp;See other options above.</p>


</blockquote>


<hr>


<p><i>Copyright (c) 2006 Microsoft Corporation. All rights reserved.</i></p>
</body> 
</html>